import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/base/base_controller.dart';
import 'package:sports_new/utils/utils.dart';
import 'package:umeng_apm_sdk/umeng_apm_sdk.dart';
import 'package:sports_new/server/api/ai_api.dart';
import '../../entity/ai/model_entity.dart';
import '../../entity/other/resource_entity.dart';
import '../../server/api/home_api.dart';

class AiLogic extends BaseController{
  List<ModelEntity>? data;
  List<ResourceEntity>? lbt;
  final ScrollController scrollController = ApmScrollController();

@override
  void onReady() {
    getData();
    super.onReady();
  }

  Future getData() async{
    lbt = await HomeApi.getResources("app_ai");
    data = await AiApi.modelAll() ?? [];
    update();
  }

  doRefresh(){
    if(refreshController.headerState?.mode.isIdle == false) return;
    refreshController.callRefresh();
  }

  @override
  void getRefresh() {
    getData();
    super.getRefresh();
  }
}